<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
           display: flex;
           justify-content: center;
           align-items: center;
          margin-top: 100px;
          /* color: darkgray; */
        }
    </style>
</head>

<body>
    <div>
        <label for="for">搜索:</label>
        <input type="text" id="for" value="胡歌">
    </div>
    <script>
        var inp=document.querySelector('input')
        inp.onfocus=function(){
                //  console.log('赵玉真');
                if(this.value=="胡歌"){
                    this.value='';
                }
                this.style.color='#333'
        }
        inp.onblur=function(){
            if(this.value==''){
                this.value="胡歌"
            }
            console.log('fh');
            this.style.color='darkgray'
        }

    </script>
</body>
</html>